Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
@vonage/js-workerizer
Advanced tools
Library providing a simple way to run a class instance on its dedicated worker.
Library providing a simple way to run a class instance on its dedicated worker.
# Install dependencies
npm install @vonage/js-workerizer
# from the example/basic directory
npm install
npm run dev
import { MyWorkerizableClass } from "./my-workerizable-class.ts";
import Worker from "./my-workerizable-class.ts?worker&inline";
const onMainThread = new MyWorkerizableClass();
onMainThread.doSomething(); // run on the main thread
const onAWorker = await workerize(MyWorkerizableClass, Worker);
await onMainThread.doSomething(); // run on a worker
Imaging you want to run this class in a worker.
export class HugeProcessClass {
run() {
// ... super slow process
}
}
// Class usage
const process = new HugeProcessClass();
process.run(); // will run on the main thread
We suggest to call it in the static constructor of the class. Decorator should be provided soon as typescript release them.
export class HugeProcessClass {
// ... class impl
// These lines allow the class to be used in a worker
static {
registerWorker('HugeProcessClass', this);
}
}
// Class usage
const process = await workerize(HugeProcessClass);
await process.run(); // will run on a worker
export class SomeClass {
// this method will be call if defined before the worker is terminated
public terminate() {
}
// These lines allow the class to be used in a worker
static {
registerWorker('HugeProcessClass', this);
}
}
// Class usage
const worker = await workerize(SomeClass);
await worker.terminate();
This project is licensed under the terms of the MIT license and is available for free.
FAQs
Library providing a simple way to run a class instance on its dedicated worker.
The npm package @vonage/js-workerizer receives a total of 1,246 weekly downloads. As such, @vonage/js-workerizer popularity was classified as popular.
We found that @vonage/js-workerizer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 42 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.